<!--包含头部文件-->
{include file="public/header" /}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> 商品添加 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
	<form class="form form-horizontal form-o2o-add" id="form-o2o-add" method="post" action="{:url('goods/add')}" enctype="multipart/form-data">
		<table class="table">
			<tbody>
				<tr>
					<th class="text-r" width="80">商品品牌：</th>
					<td><input type="text" class="input-text text-l" name="brand" value="" style="width: 150px;"></td>
				</tr>
				<tr>
					<th class="text-r" width="80">商品名：</th>
					<td><input type="text" class="input-text text-l" name="gname" value="" style="width: 150px;"></td>
				</tr>
				<tr>
					<th class="text-r">商品图片</th>
					<td>
					<span class="btn-upload form-group">
						<input class="input-text upload-url" type="text" name="image" id="uploadfile-2" readonly style="width:150px">
						<a href="javascript:void();" class="btn btn-primary upload-btn"><i class="Hui-iconfont">&#xe642;</i> 上传logo</a>
						<input type="file" name="image" class="input-file">
					</span>
					</td>
				</tr>
				<tr>
					<th class="text-r">所属分类：</th>
					<td>
						<span class="select-box" style="width:150px">
							<select class="select firstId" name="category1_id" size="1">
								<option value="0" selected>一级分类</option>
								{volist name="types" id="vo"}
									<option value="{$vo.id}">|---{$vo.name}</option>
								{/volist}
							</select>
						</span>
						<span class="select-box" style="width:150px">
							<select class="select secType" name="category2_id" size="1">
								<option value="0" selected>二级分类</option>
							</select>
						</span>
					</td>
				</tr>
				<tr>
					<th class="text-r">市场价：</th>
					<td><input type="text" class="input-text text-l"  value="" name="market_price" style="width: 150px;"></td>
				</tr>
				<tr>
					<th class="text-r">价格：</th>
					<td><input type="text" class="input-text text-l"  value="" name="price" style="width: 150px;"></td>
				</tr>
				<tr>
					<th class="text-r">库存：</th>
					<td><input type="text" class="input-text text-l" value="" name="stock" style="width: 150px;"></td>
				</tr>
				<tr>
					<th class="text-r" style="vertical-align: top;">商品详情：</th>
					<td>
						<textarea name="description" id="" style="vertical-align: top;width: 500px;height: 80px;"></textarea>
					</td>
				</tr>
			</tbody>
		</table>
		<button  type="submit" class="btn btn-primary radius" style="margin-left: 30px;margin-top: 10px;" ><i class="Hui-iconfont">&#xe600;</i> 添加</button>
	</form>
</div>

<!--包含尾部文件-->
{include file="public/footer" /}
{load href="__STATIC__/admin/js/common.js" /}
<script>
var SCOPE = {
	'secondType_url': "{:url('type/getSecondType')}",
  };

$('.firstId').change(function(){
	firstId = $(this).val();
	data = {'id':firstId};
	url = SCOPE.secondType_url;
	$.post(url,data,function(result){
		if (result.status == 1) {
			data = result.data['data'];
			sec_html = '';
			  $(data).each(function(i){
	                sec_html += "<option value='"+this.id+"'>"+this.name+"</option>";

	           });
			$('.secType').html(sec_html);
		}else if(result.status == 0){
			$('.secType').html('');
			return;
		}
	},'json');
});	
</script>

</body>
</html>